﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NCalculator.Operations
{
    [Serializable()]
    public abstract class OperationNode : Node
    {
        #region Attributes
        protected Node _left;
        protected Node _right;
        protected int _priority;
        // 1 parentheses
        // 2 squere roots and powers
        // 3 multiplication and division 
        // 4 addition and substraction
        #endregion

        /// <summary>
        /// Returns operation priority using when order of execution is calculating
        /// </summary>
        public int Priority
        {
            get { return _priority; }
            private set { }
        }

        #region Left and right node Set/Get
        /// <summary>
        /// Get/Set left value
        /// </summary>
        public Node Left
        {
            get { return _left; }
            set
            {
                if (value != null)
                    _left = value;
            }
        }

        /// <summary>
        /// Get/Set right value 
        /// </summary>
        public Node Right
        {
            get { return _right; }
            set
            {
                if (value != null)
                    _right = value;
            }
        }
        #endregion
    }
}
